package com.haima.sage.bigdata.api.frame.filter;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.haima.sage.bigdata.api.frame.condition.ConditionGroup;
import com.haima.sage.bigdata.api.frame.filter.impl.JsonFilter;

@JsonTypeInfo(use = JsonTypeInfo.Id.NAME,
        include = JsonTypeInfo.As.EXISTING_PROPERTY,
        property = "type",
        defaultImpl = JsonFilter.class,
        visible = true)
@JsonSubTypes({
        @JsonSubTypes.Type(value = JsonFilter.class, name = "json")})
public abstract class Filter<T extends FilterService<?>> {
    protected FilterType type;
    protected ConditionGroup condition;

    public abstract T service();

    public FilterType getType() {
        return type;
    }

    public void setType(FilterType type) {
        this.type = type;
    }

    public ConditionGroup getCondition() {
        return condition;
    }

    public void setCondition(ConditionGroup condition) {
        this.condition = condition;
    }
}
